define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'system.wx_user/index',
        user_index_url: 'system.wx_user/user_index',
        add_url: 'system.wx_user/add',
        edit_url: 'system.wx_user/edit',
        delete_url: 'system.wx_user/delete',
        export_url: 'system.wx_user/export',
        modify_url: 'system.wx_user/modify',
    };

    var Controller = {

        index: function () {    //身份管理
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '主键ID'},
                    {field: 'user_id', title: '上级用户ID'},
                    {field: 'wx_name', title: '微信昵称'},
                    {field: 'wx_number', title: '微信号'},
                    {field: 'user_phone', title: '手机号'},
                    {field: 'user_name', title: '姓名'},
                    {field: 'identity_id', title: '身份ID'},
                    {field: 'user_address', title: '所属地址'},
                    {field: 'company_address', title: '公司地址'},
                    {field: 'company_name', title: '公司名称'},
                    {field: 'create_time', title: '创建时间'},
                    {field: 'user_status', title: '用户状态'},
                    {field: 'systemIdentity.id', title: '主键ID'},
                    {field: 'systemIdentity.identity', title: '身份'},
                    {field: 'systemIdentity.identity_status', title: '状态'},
                    {field: 'systemIdentity.create_time', title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        user_index: function () {    //用户管理
            ea.table.render({
                init: init,
                url: 'user_index',
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '主键ID'},
                    {field: 'user_id', title: '上级用户ID'},
                    {field: 'wx_name', title: '微信昵称'},
                    {field: 'wx_number', title: '微信号'},
                    {field: 'user_phone', title: '手机号'},
                    {field: 'user_name', title: '姓名'},
                    {field: 'identity_id', title: '身份ID'},
                    {field: 'user_address', title: '所属地址'},
                    {field: 'company_address', title: '公司地址'},
                    {field: 'company_name', title: '公司名称'},
                    {field: 'create_time', title: '创建时间'},
                    {field: 'user_status', title: '用户状态'},
                    {field: 'systemIdentity.id', title: '主键ID'},
                    {field: 'systemIdentity.identity', title: '身份'},
                    {field: 'systemIdentity.identity_status', title: '状态'},
                    {field: 'systemIdentity.create_time', title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});